import request from '@/utils/request'
import axios from 'axios';
import { getToken } from '@/utils/auth'
import { data } from 'jquery';
export function getcarousel() {
  return request({
    url: '/pcclinet/getcarousel',
    method: 'post',

  })
}
export function searchgoodsinfo(data) {
    return request({
      url: '/pcclinet/searchgoodsinfo',
      method: 'post',
      data:data
    })
  }


export function uploadgoodsinfo(data){
  return request({
    url: '/pcclinet/uploadgoodsinfo',
    method: 'post',
    data:data,
    headers:{
      'Content-Type': 'multipart/form-data'
    }
    
  })
}


export function searchreport(data){
  return request({
    url: '/pcclinet/searchreport',
    method: 'post',
    data:data
  })
}
export function searchwaitsendorderlist(data){
  return request({
    url: '/pcclinet/searchwaitsendorderlist',
    method: 'post',
    data:data
  })
}
export function chanhegoodsinfo(data){
  return request({
    url: '/pcclinet/chanhegoodsinfo',
    method: 'post',
    data:data,
    headers:{
      'Content-Type': 'multipart/form-data'
    }
    
  })
}

  export function getcostomer() {
    return request({
      url: '/pcclinet/getcostomer',
      method: 'post',
  
    })
  }
  export function searchrefundorderlist(data) {
    return request({
      url: '/pcclinet/searchrefundorderlist',
      method: 'post',
      data:data||null
    })
  }
  export function searchwaitorderlist(data) {
    return request({
      url: '/pcclinet/searchwaitorderlist',
      method: 'post',
      data:data
    })
  }
  export function searchsendorderlist(data) {
    return request({
      url: '/pcclinet/searchsendorderlist',
      method: 'post',
      data:data
    })
  }
  export function searchsuccessorderlist(data) {
    return request({
      url: '/pcclinet/searchsuccessorderlist',
      method: 'post',
      data:data
    })
  }
  export function getreport() {
    return request({
      url: '/pcclinet/getreport',
      method: 'post',
  
    })
  }
  export function searchorderlist(data) {
    return request({
      url: '/pcclinet/searchsendorderlist',
      method: 'post',
      data:data
    })
  }
  //一键发货
  export function allsend(data) {
    return request({
      url: '/pcclinet/allsend',
      method: 'post',
      data:data
    })
  }
  //退款订单
  export function refundorder(data) {
    return request({
      url: '/pcclinet/refundorder',
      method: 'post',
      data:data
    })
  }

  export function getcoupons(data) {
    return request({
      url: '/pcclinet/getcoupons',
      method: 'post',
      data:data
    })
  }

  //优惠券制作
  export function addcoupons(data) {
    return request({
      url: '/pcclinet/addcoupons',
      method: 'post',
      data:data
    })
  }

//已退款订单searchalreadyrefundorderlist
export function searchalreadyrefundorderlist(data) {
  return request({
    url: '/pcclinet/searchalreadyrefundorderlist',
    method: 'post',
    data:data
  })
}

//更改商品状态
export function changegoodsstate(data) {
  return request({
    url: '/pcclinet/changegoodsstate',
    method: 'post',
    data:data
  })
}

//更改轮播图状态开关
export function chanhecarouselstate(data) {
  return request({
    url: '/pcclinet/chanhecarouselstate',
    method: 'post',
    data:data
  })
}

// 分类列表
export function goodslx() {
  return request({
    url: '/wxapplet/goodslx',
    method: 'post',
  })
}

// 获取积分配置
export function getpointsset() {
  return request({
    url: '/pcclinet/getpointsset',
    method: 'post',
  })
}
// 修改积分配置
export function uppointsset(data){
  return request({
    url: '/pcclinet/uppointsset',
    method: 'post',
    data: {
      data:data
    }
  })
}


// 添加广播
export function addbroadcast(data){
  return request({
    url: '/pcclinet/broadcast',
    method: 'post',
    data:data
  
  })
}

  // export function uploadcarousel({ signatureImage, mp4 }) {
  //   const formData = new FormData();
  
  //   if (mp4) {
  //     formData.append('mp4', mp4);
  //   }
  
  //   if (signatureImage) {
  //     formData.append('signatureImage', signatureImage);
  //   }
  
  //   //  console.log('FormData Entries:', [...formData.entries()]); // 调试信息
  
  //   return axios.post('https://shop.flowergk.com/shop/pcclinet/uploadcarousel', formData, {
  //     headers: {
  //       'Content-Type': 'multipart/form-data',
  //     },
  //   });
  // }
  
  export function uploadcarousel({ signatureImage, mp4 }) {
    const formData = new FormData();
    
    if (signatureImage) {
      formData.append('signatureImage', signatureImage);
    }
  
    if (mp4) {
      formData.append('mp4', mp4);
    }
  
    return axios.post('https://shop.flowergk.com/shop/pcclinet/uploadcarousel', formData, {
      headers: {
        'Authorization':getToken(),
        'Content-Type': 'multipart/form-data',
      },
    });
  }

  // 快递信息
  export function getexpress(data) {
    return request({
      url: '/pcclinet/logistics',
      method: 'post',
      data:data
    })
  }
  //快递签收
  export function getexpresssign(data) {
    return request({
      url: '/pcclinet/signlogistics',
      method: 'post',
      data:data
    })
  }

  // 商品等级
  export function getgrade() {
    return request({
      url: '/pcclinet/getgrade',
      method: 'post',
    })
  }

  // 销售报表
  export function searchsalereport(data) {
    return request({
      url: '/pcclinet/searchsalereport',
      method: 'post',
      data:data
    })
  }